<?php

namespace App\Models;

use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class Cart
 * @package App\Models
 * @version September 16, 2017, 6:05 am UTC
 *
 * @property integer user_id
 * @property integer goods_id
 * @property integer attribute_id
 * @property integer number
 * @property integer is_real
 */
class Cart extends Model
{
    use SoftDeletes;

    public $table = 'carts';
    

    protected $dates = ['deleted_at'];


    public $fillable = [
        'shop_id',
        'user_id',
        'goods_id',
        'attribute_id',
        'number',
        'is_real'
    ];

    /**
     * The attributes that should be casted to native types.
     *
     * @var array
     */
    protected $casts = [
        'user_id' => 'integer',
        'goods_id' => 'integer',
        'attribute_id' => 'integer',
        'number' => 'integer',
        'is_real' => 'integer'
    ];

    /**
     * Validation rules
     *
     * @var array
     */
    public static $rules = [
        
    ];

    public function goods()
    {
        return $this->belongsTo('App\Models\Goods');
    }

    public function attribute()
    {
        return $this->belongsTo('App\Models\GoodsAttribute','attribute_id');
    }

    
}
